/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sbbs.jpa.entity.enumtype;

import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import org.sbbs.jpa.entity.UUIDBaseEntity;

/**
 *
 * @author Mr.fdc <fdc_messenger@126.com>
 */
@Entity
@Table(name = "Phone")
public class Phone extends UUIDBaseEntity {

//    @Id
//    private Long id;
    private String number;

    private PhoneType type;

    private PhoneType phonetype;

    @Enumerated(EnumType.ORDINAL)
    @Column(name = "phone_type_1")
    public PhoneType getPhonetype() {
        return phonetype;
    }

//    public Long getId() {
//        return id;
//    }
//
//    public void setId(Long id) {
//        this.id = id;
//    }
    public void setPhonetype(PhoneType phonetype) {
        this.phonetype = phonetype;
    }

    @Column(name = "phone_number")
    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    @Enumerated(EnumType.STRING)
    @Column(name = "phone_type")
    public PhoneType getType() {
        return type;
    }

    public void setType(PhoneType type) {
        this.type = type;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 29 * hash + Objects.hashCode(this.number);
        hash = 29 * hash + Objects.hashCode(this.type);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Phone other = (Phone) obj;
        if (!Objects.equals(this.number, other.number)) {
            return false;
        }
        if (this.type != other.type) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Phone{" + "number=" + number + ", type=" + type + '}';
    }

}
